import request from '@/config/axios'

export interface SocialAuthVO {
  id: number
  socialType: number
  corpid: string
  corpsecret: string
  appid: string
  accessToken: string
  agentId: string
  redirectUrl: string
}

// 查询社交授权分页
export const getSocialAuthPage = async (params) => {
  return await request.get({ url: `/system/social-auth/page`, params })
}
// 查询社交授权列表
export const getSocialAuthList = async (params) => {
  return await request.get({ url: `/system/social-auth/list`, params })
}

// 查询社交授权详情
export const getSocialAuth = async (id: number) => {
  return await request.get({ url: `/system/social-auth/get?id=` + id })
}

// 新增社交授权
export const createSocialAuth = async (data: SocialAuthVO) => {
  return await request.post({ url: `/system/social-auth/create`, data })
}

// 修改社交授权
export const updateSocialAuth = async (data: SocialAuthVO) => {
  return await request.put({ url: `/system/social-auth/update`, data })
}

// 删除社交授权
export const deleteSocialAuth = async (id: number) => {
  return await request.delete({ url: `/system/social-auth/delete?id=` + id })
}

// 导出社交授权 Excel
export const exportSocialAuth = async (params) => {
  return await request.download({ url: `/system/social-auth/export-excel`, params })
}

// 测试社交授权是否可用
export const test = async (id: number) => {
  return await request.post({ url: `/system/social-auth/test?id=` + id })
}
